package cn.livingCloud.dto;

import cn.livingCloud.entity.content.Article;
import cn.livingCloud.utils.DateUtils;

import java.util.Date;

/**
 * Created by DingJie  on 2016/1/15.
 */
public class ArticleFormDto {

    private String uuid;
    //文章标题
    private String title;
    //标题颜色
    private String color;
    //是否加粗
    private boolean strong;
    //内容
    private String content;
    //是否发布
    private boolean publish;
    //创建日期
    private String createTime;
    //最后修改日期
    private String lastModifyTime;

    private String name;

    public ArticleFormDto() {
    }

    public ArticleFormDto(Article article) {
        this.uuid = article.getUuid();
        this.title = article.getTitle();
        this.color = article.getColor();
        this.strong = article.isStrong();
        this.content = article.getContent();
        this.publish = article.isPublish();
        this.name = article.getCreater().getName();
        this.createTime = DateUtils.toDateText(article.getCreateTime()
                , DateUtils.DEFAULT_DATE_TIME_FORMAT);
        this.lastModifyTime = DateUtils.toDateText(article.getLastModifyTime()
                , DateUtils.DEFAULT_DATE_TIME_FORMAT);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public boolean isStrong() {
        return strong;
    }

    public void setStrong(boolean strong) {
        this.strong = strong;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public boolean isPublish() {
        return publish;
    }

    public void setPublish(boolean publish) {
        this.publish = publish;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getLastModifyTime() {
        return lastModifyTime;
    }

    public void setLastModifyTime(String lastModifyTime) {
        this.lastModifyTime = lastModifyTime;
    }

    public void update(Article article) {
        article.setStrong(this.strong);
        article.setColor(this.color);
        article.setTitle(this.title);
        article.setContent(this.content);
        article.setLastModifyTime(new Date());
    }
}
